pp108 : confirm() Method

confirm() Method

 


This method displays confirmation messages that are required to proceed to the next step of a procedure.

Syntax


application.confirm(sMessage, [bCancelable], [fpCallBackHandler], [bOnCordysRoot], [sTitle])

Parameters

Parameter

Description

sMessage

Required. Denotes the confirmation message to be displayed.

bCancelable

Optional. Boolean that indicates whether you can cancel the confirmation message. If set to True, a Cancel button appears with the message.

fpCallBackHandler

Optional. Denotes the function to be called when the confirmation message is closed. The function is called with the selected value.

bOnCordysRoot

Optional. Boolean that if set to True displays the confirmation message on the CordysRoot. By default, this is set to False.

sTitle

Optional. Denotes the title of the confirmation message. The default title is 'Confirm.'

 

Return Value

Returns the following:

  • 1: Returns this value when you confirm the confirmation message.
  • 0: Returns this value when you deny the confirmation message.
  • null: Returns this value when you cancel or close the confirmation message.

    If the confirm() method is executed before closing the application (using the onbeforeapplicationclose event), the fpcallback Handler parameter should return either True or False based on the option you selected (Yes, No, or Cancel).

Remarks

  • Confirmation messages display Yes, No, and Cancel buttons.
  • For a confirmation message that contains a Cancel button, using the close icon in the toolbar to close the message results in the cancel action.
  • For a confirmation message that does not contain a Cancel button (bCancelableset as false), the close icon is not available on the toolbar.
  • An application can display only one confirmation message at a time.
  • You cannot cancel confirmation messages programmatically.

Example

function callConfirm()
{
    application.confirm("Do you want to proceed ?", true, closeHandler, false, "Confirm Message");
}
function closeHandler(confirmReturnValue)
{
    if (confirmReturnValue == 1)
       {
          // The logic if the user said 'Yes'.
       }
    else if (confirmReturnValue == 0)
       {
          // The logic if the user said 'No'.
       }
    else
       {
          // The logic if the user said 'Cancel'.
       }
}